/**
 * 70. 爬楼梯
 * https://leetcode-cn.com/problems/climbing-stairs/
 */

/**
 * @param {number} n
 * @return {number}
 */
function climbStairs(n) {
  const dp = new Array(n + 1).fill(1);
  for (let i = 2; i <= n; i += 1) {
    dp[i] = dp[i - 1] + dp[i - 2];
  }
  return dp[n];
}

console.log(climbStairs(1) === 1);
console.log(climbStairs(2) === 2);
console.log(climbStairs(3) === 3);
console.log(climbStairs(4) === 5);
